package com.yuntuzhilian.chapter4;

/**
 * @author MrWang-shuizhishuiheshui
 * @description 线程的生命周期
 */
public class Demo4 implements Runnable {

    @Override
    public void run() {
        try {
            System.out.println("线程"+Thread.currentThread().getName()+"运行");
            //当前线程休眠
            Thread.sleep(1000);
            System.out.println("线程"+Thread.currentThread().getName()+"运行");
        } catch (InterruptedException e) {
            System.out.println("异常死亡");
        }
    }

    public static void main(String[] args) {
        Thread thread=new Thread(new Demo4());
        System.out.println("线程创建");
        thread.start();
        System.out.println("就绪状态");
    }
}
